home *** CD-ROM | disk | FTP | other *** search
/ TeX 1995 July / TeX CD-ROM July 1995 (Disc 1)(Walnut Creek)(1995).ISO / biblio / bibtex / mac / bib.hqx / Bib Stack / card_3782.txt < prev    next >
Text File  |  1989-12-05  |  6KB  |  207 lines

  1. -- card: 3782 from stack: in
  2. -- bmap block id: 0
  3. -- flags: 4000
  4. -- background id: 3544
  5. -- name: 
  6.  
  7.  
  8. -- part 1 (field)
  9. -- low flags: 01
  10. -- high flags: 0002
  11. -- rect: left=7 top=59 right=286 bottom=504
  12. -- title width / last selected line: 0
  13. -- icon id / first selected line: 0 / 0
  14. -- text alignment: 0
  15. -- font id: 34
  16. -- text size: 12
  17. -- style flags: 0
  18. -- line height: 16
  19. -- part name: help
  20.  
  21.  
  22. -- part 2 (button)
  23. -- low flags: 00
  24. -- high flags: 8002
  25. -- rect: left=13 top=80 right=104 bottom=114
  26. -- title width / last selected line: 0
  27. -- icon id / first selected line: 0 / 0
  28. -- text alignment: 1
  29. -- font id: 0
  30. -- text size: 12
  31. -- style flags: 0
  32. -- line height: 16
  33. -- part name: Dump Data ...
  34. ----- HyperTalk script -----
  35. on mouseUp
  36.   global cardList, dumpFile
  37.  
  38.   set cursor to 4
  39.   push card
  40.   set lockscreen to true
  41.  
  42.   -- Make a list of items for the xcmd
  43.   put cardList & "," & "All" into tempList
  44.   -- Convert semicolons to commas
  45.   repeat with x = 1 to length of tempList
  46.     if char x of tempList = return then
  47.       put "," into char x of tempList
  48.     end if
  49.   end repeat
  50.   put "Pick the card types to dump."
  51.   DoList "Dump","Cancel", tempList, DIS
  52.   put empty
  53.   hide message
  54.  
  55.   if the result is empty then exit mouseUp
  56.   put the result into bkgndList
  57.   put item 1 of bkgndList into numBkgnd
  58.   if "All" is in bkgndList then
  59.     put item 1 of tempList into bkgndList
  60.     repeat with x = 2 to number of items in tempList
  61.       put bkgndList & "," & item x of tempList into bkgndList
  62.     end repeat
  63.     answer bkgndList
  64.     put the number of items in bkgndList into numBkgnd
  65.     answer numBkgnd
  66.   end if
  67.  
  68.   -- Select a file to dump to
  69.   put NewFileName("Save dump to",dumpFile) into temp
  70.   if temp is empty then exit mouseUp
  71.   set cursor to 4
  72.   put temp into dumpFile
  73.   open file dumpFile
  74.  
  75.   repeat with x = 1 to numBkgnd
  76.  
  77.     -- item x+1 of bkgndList is the background to dump
  78.     put item x+1 of bkgndList into bkgndName
  79.     go to card 1 of bkgnd bkgndName
  80.     put the number of cards of this bkgnd into bkgndLength
  81.  
  82.     -- go through the cards and write them out.
  83.     repeat with y = 1 to bkgndLength
  84.       go to card y of this bkgnd
  85.       put "Card " & y & " of " & bkgndLength
  86.  
  87.       write field "card Type" to file dumpFile
  88.       write tab & field "Read Status" to file dumpFile
  89.       write tab & field author to file dumpFile
  90.       write tab & field title to file dumpFile
  91.       write tab & field key to file dumpFile
  92.       write tab & field journal to file dumpFile
  93.       write tab & field "Book Title" to file dumpFile
  94.       write tab & field Month to file dumpFile
  95.       write tab & field Year to file dumpFile
  96.       write tab & field Chapter to file dumpFile
  97.       write tab & field Pages to file dumpFile
  98.       write tab & field "Editor" to file dumpFile
  99.       write tab & field "Organization" to file dumpFile
  100.       write tab & field "Publisher" to file dumpFile
  101.       write tab & field "How Published" to file dumpFile
  102.       write tab & field address to file dumpFile
  103.       write tab & field volume to file dumpFile
  104.       write tab & field series to file dumpFile
  105.       write tab & field edition to file dumpFile
  106.       write tab & field "Type" to file dumpFile
  107.       write tab & field "Number" to file dumpFile
  108.       write tab & field "Bibliography Note" to file dumpFile
  109.       write tab & field notes to file dumpFile
  110.       write tab & field "Key words" to file dumpFile
  111.       write tab & field "location" to file dumpFile
  112.       write tab to file dumpFile
  113.       write return to file dumpFile
  114.  
  115.     end repeat
  116.  
  117.   end repeat
  118.  
  119.   close file dumpFile
  120.  
  121.   -- save the file name
  122.   put LastPathComponent(dumpFile) into dumpFile
  123.   hide message
  124.   pop card
  125.  
  126. end mouseUp
  127.  
  128.  
  129.  
  130. -- part 3 (button)
  131. -- low flags: 00
  132. -- high flags: 8002
  133. -- rect: left=13 top=109 right=133 bottom=114
  134. -- title width / last selected line: 0
  135. -- icon id / first selected line: 0 / 0
  136. -- text alignment: 1
  137. -- font id: 0
  138. -- text size: 12
  139. -- style flags: 0
  140. -- line height: 16
  141. -- part name: Fill Data ...
  142. ----- HyperTalk script -----
  143. on mouseUp
  144.   global dumpFile
  145.  
  146.   set cursor to 4
  147.   push card
  148.   --set lockscreen to true
  149.  
  150.   -- Select a file to open
  151.   put "Select a file with bibliography data"
  152.   put FileName("TEXT") into temp
  153.   put empty
  154.   hide message
  155.   if temp is empty then exit mouseUp
  156.   set cursor to 4
  157.   put temp into dumpFile
  158.   open file dumpFile
  159.  
  160.   repeat while  true
  161.  
  162.     put readField(dumpFile) into cardType -- this field says card or bkgnd
  163.     --put it into cardType
  164.     if cardType is empty or cardType is return then exit repeat
  165.  
  166.     go to bkgnd cardType
  167.  
  168.     do "makeNewCard"
  169.  
  170.     play "harpsichord" "Ct6"
  171.  
  172.     put the number of bkgnd fields into numFields
  173.  
  174.     put cardType into bkgnd field "Card Type"
  175.  
  176.     repeat with x = 2 to numFields
  177.       put readField(dumpFile) into bkgnd field x
  178.     end repeat
  179.  
  180.     read from file dumpFile until return
  181.  
  182.   end repeat
  183.  
  184.   close file dumpFile
  185.  
  186.   -- save the file name
  187.   put LastPathComponent(dumpFile) into dumpFile
  188.   hide message
  189.   pop card
  190.  
  191. end mouseUp
  192.  
  193.  
  194.  
  195. -- part contents for background part 6
  196. ----- text -----
  197. The last buttons
  198.  
  199. -- part contents for card part 1
  200. ----- text -----
  201. These buttons dump bibliography information to a text file and read bibliography
  202.                                     information from a text file. Because they are so little used, this 
  203.                                     is the only card on which they are located. The format of the text
  204.                                     file is    <data for a card> return <data for a card> return ....
  205.                                     with a return ending the file. The data for a card is the field information, in field number order, separated by tabs:
  206.    <data in bkgnd field 1> tab <data in bkgnd field 2> tab .....<data in bkgnd field N> tab
  207. where N is the number of bkgnd fields on a bibliography card (to find this, find the number of lines in the variable cardList).